-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: collect go migrations #588
Conversation
check.Number(t, all[2].Version, 19081) | ||
check.Number(t, all[3].Version, 19082) | ||
}) | ||
t.Run("filesystem_registered_with_multiple_dirpath", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafalneves this test aims to capture what I think you're trying to do, but if you could look over this specific subtest that'd be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's it. Thanks!
@@ -30,7 +30,7 @@ func CreateWithTemplate(db *sql.DB, dir string, tmpl *template.Template, name, m | |||
|
|||
if sequential { | |||
// always use DirFS here because it's modifying operation | |||
migrations, err := collectMigrationsFS(osFS{}, dir, minVersion, maxVersion) | |||
migrations, err := collectMigrationsFS(osFS{}, dir, minVersion, maxVersion, registeredGoMigrations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR, but both create and fix functions do not need the global registered migrations.
They should only operate on the os filesystem.
Fix #582
This PR reinstates the existing behaviour where users can register Go migrations manually without having the corresponding files on disk, or in the embedded filesystem. This is accomplished using the
goose.AddNamedMigration..
set of functions.Fix #553
This PR also allows registering Go migrations, while filtering them down to only those found in the filesystem based on the specific directory.
We continue to preserve the behaviour where a valid looking .go file doesn't have a corresponding registered migration raises an error.
I've also added a number of tests to capture all this behaviour. See
TestCollectMigrations
for more details.